API: Change semantics of gtk_container_get_child_path()
authorBenjamin Otte <otte@redhat.com>
Wed, 25 May 2011 20:21:15 +0000 (22:21 +0200)
committerBenjamin Otte <otte@redhat.com>
Thu, 2 Jun 2011 00:03:50 +0000 (02:03 +0200)
Include the child widget path in the returned path now. This allows
customizing the path of the current widgets - like adding flags to child
widgets (and maybe siblings in the future).

gtk/gtkcontainer.c
gtk/gtkframe.c
gtk/gtknotebook.c
gtk/gtktreeview.c
gtk/gtkwidget.c

index 50a451444870f0eb3a39276bafe6f67046111e90..4b27fd621004d7cd36680e4789b0efcd0ca0b516 100644 (file)
@@ -2334,6 +2334,8 @@ gtk_container_real_get_path_for_child (GtkContainer *container,
       g_list_free_1 (cur);
     }
 
+  gtk_widget_path_append_for_widget (path, child);
+
   return path;
 }
 
@@ -3362,7 +3364,7 @@ _gtk_container_get_reallocate_redraws (GtkContainer *container)
  * @child: a child of @container
  *
  * Returns a newly created widget path representing all the widget hierarchy
- * from the toplevel down to @child (this one not being included).
+ * from the toplevel down to and including @child.
  *
  * Returns: A newly created #GtkWidgetPath
  **/
index 5f201cce18b1c0f5c05b894e41506cd5fbe08ab5..f0a42ed9532639815093a08a2a951f1d3cf9c736 100644 (file)
@@ -384,7 +384,9 @@ gtk_frame_get_path_for_child (GtkContainer *container,
   path = GTK_CONTAINER_CLASS (gtk_frame_parent_class)->get_path_for_child (container, child);
 
   if (child == priv->label_widget)
-    gtk_widget_path_iter_add_class (path, -1, GTK_STYLE_CLASS_FRAME);
+    gtk_widget_path_iter_add_class (path,
+                                    gtk_widget_path_length (path) - 2,
+                                    GTK_STYLE_CLASS_FRAME);
 
   return path;
 }
index 88835d3e348fd85890428312f177feed2a17fc33..8cb21a70db3545a8edb8084568df40cd79fe5bb3 100644 (file)
@@ -4454,7 +4454,6 @@ gtk_notebook_get_path_for_child (GtkContainer *container,
   GtkNotebook *notebook;
   GtkNotebookPage *page;
   GtkWidgetPath *path;
-  GtkRegionFlags flags;
   GList *c;
 
   path = GTK_CONTAINER_CLASS (gtk_notebook_parent_class)->get_path_for_child (container, widget);
@@ -4474,8 +4473,10 @@ gtk_notebook_get_path_for_child (GtkContainer *container,
   if (!c)
     return path;
 
-  flags = _gtk_notebook_get_tab_flags (notebook, page);
-  gtk_widget_path_iter_add_region (path, -1, GTK_STYLE_REGION_TAB, flags);
+  gtk_widget_path_iter_add_region (path, 
+                                   gtk_widget_path_length (path) - 2,
+                                   GTK_STYLE_REGION_TAB,
+                                   _gtk_notebook_get_tab_flags (notebook, page));
 
   return path;
 }
index 912b0fb0640de9f662a49013485261befcd378f3..3a003b708f1aaedf51951541246985ae5a9400cf 100644 (file)
@@ -8540,6 +8540,8 @@ gtk_tree_view_get_path_for_child (GtkContainer *container,
       break;
     }
 
+  gtk_widget_path_append_for_widget (path, child);
+
   return path;
 }
 
index 9a598107da11b00ca49f4c6c957b03998a7eb968..340dd9ef008fce2194dc1d7a38bb16f504b366fa 100644 (file)
@@ -14312,10 +14312,10 @@ gtk_widget_get_path (GtkWidget *widget)
            * situation.
            */
           widget->priv->path = gtk_widget_path_new ();
+    
+          gtk_widget_path_append_for_widget (widget->priv->path, widget);
         }
 
-      gtk_widget_path_append_for_widget (widget->priv->path, widget);
-
       if (widget->priv->context)
         gtk_style_context_set_path (widget->priv->context,
                                     widget->priv->path);